package com.flower.enjoyment.flower.controller;

import com.flower.enjoyment.flower.base.ResultMsg;
import com.flower.enjoyment.flower.entityDo.FlowerCardDo;
import com.flower.enjoyment.flower.entityDo.SysPayDo;
import com.flower.enjoyment.flower.enumUtils.ResultEnum;
import com.flower.enjoyment.flower.service.FlowerCardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/flowerCardHomeApi")
@Api(value = "花享卡信息",description = "花享卡信息")
public class FlowerCardHomeController {

    @Autowired
    private FlowerCardService flowerCardService;



    @ApiOperation(value="花享卡首页", notes="花享卡首页")
    @ResponseBody
    @GetMapping("/flowerCardHome")
    public ResultMsg<FlowerCardDo> getflowerCardHome(){
        Map map = new HashMap();
        List<FlowerCardDo> flowerCardDos = flowerCardService.selectCardList(1);
        map.put("bannerCard",flowerCardDos);
        List<FlowerCardDo> flowerCard = flowerCardService.selectCardList(0);
        map.put("listCard",flowerCard);
        return new ResultMsg(ResultEnum.SUCCESS_CODE.getCode(),map);
    }
    @ApiOperation(value="花享卡详情", notes="花享卡详情")
    @ResponseBody
    @GetMapping("/flowerCardDetail")
    public ResultMsg<FlowerCardDo> getflowerCardDetail(@ApiParam(value = "卡ID") @RequestParam( value = "cardId", required = true) String cardId){
        FlowerCardDo flowerCardDo = flowerCardService.selectByPrimaryKey(cardId);
        return new ResultMsg(ResultEnum.SUCCESS_CODE.getCode(),flowerCardDo);
    }
    @ApiOperation(value="花享卡支付列表", notes="花享卡支付列表")
    @ResponseBody
    @GetMapping("/flowerCardPayList")
    public ResultMsg<SysPayDo> getflowerCardPayList(){
        List<SysPayDo> sysPayDoList = flowerCardService.getSysPayList();
        return new ResultMsg(ResultEnum.SUCCESS_CODE.getCode(),sysPayDoList);
    }
}
